home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / 1994.11.gz / 1994.11 / 000004_Yves.Arrouye@imag.fr_Wed Nov 2 10:32:57 1994.msg < prev    next >
Internet Message Format  |  1994-11-30  |  5KB

  1. Received: from imag.imag.fr by cs.umb.edu with SMTP id AA27738
  2.   (5.65c/IDA-1.4.4 for <tex-k@cs.umb.edu>); Wed, 2 Nov 1994 03:36:25 -0500
  3. Received: from petole.imag.fr by imag.imag.fr with SMTP id AA06092
  4.   (5.65c8/IDA-1.4.4 for <tex-k@cs.umb.edu>); Wed, 2 Nov 1994 09:36:21 +0100
  5. Received: by petole.imag.fr (NX5.67e/NX3.0S)
  6.     id AA04134; Wed, 2 Nov 94 09:32:57 +0100
  7. Date: Wed, 2 Nov 94 09:32:57 +0100
  8. From: Yves Arrouye <Yves.Arrouye@imag.fr>
  9. Message-Id: <9411020832.AA04134@petole.imag.fr>
  10. Received: by NeXT.Mailer (1.100)
  11. Received: by NeXT Mailer (1.100)
  12. To: tex-k@cs.umb.edu
  13. Subject: xdvik-18d bug fixes (for PostScript handling)
  14.  
  15. The following patch fixes some problems in xdvik-18d:
  16.  
  17.     1. The ps: special did not set the current point.
  18.  
  19.     2. The ! special was not handled.
  20.  
  21.     3. It was absolutely impossible to keep things in SDict. This last problem
  22.        has an unsatisfactory solution: currently, I changed the @fedspecial
  23.        procedure in order to save the interpreter state in xdvi$sav (as is done
  24.        in the ps*.c files). This effectively allows modification of the
  25.        dictionaries (even TeXDict, of course) but only during a bang special,
  26.        and has the obvious advantage that if the PS code is corrupted the saved
  27.        state will be bad... (I tried to clean the state first as was done in
  28.        the ps*.c files, but this does not work for all cases.)
  29.  
  30. Regarding the third problem, I would like to propose the removal of the
  31. save/restore bracketing in xdvik code (and then also remove the reading trick
  32. for sending unbracketed code). After all, dvips (on which this is based)
  33. clearly states that using raw PostScript code is at the writer's risk, and this
  34. should be sufficient: if the PS fails, then the display in xdvik should fail
  35. too (which is what it does) but it is not necessary to oversecure the thing
  36. up to a point where correct---though not dvips-compliant---PS code cannot be
  37. executed anymore.
  38.     Another more secure solution to this problem would be the downloading of
  39. a small error-handler in the interpreter memory: if some bad PS is sent, then
  40. the error-handler would restore the prior-to-call state so that the preview
  41. can continue under good conditions; however, if no errors are found, then the
  42. new state of the interpreter will become the default error-recovery state.
  43.  
  44. Please comment on this problem and proposed solutions,
  45. Yves.
  46.  
  47. P.S.: yes, I'll do the necessary modifications if needed.
  48.  
  49. diff -u --recursive xdvik-18d-orig/xdvik/psheader.txt xdvik-18d/xdvik/psheader.txt
  50. --- xdvik-18d-orig/xdvik/psheader.txt    Mon Oct 31 09:04:33 1994
  51. +++ xdvik-18d/xdvik/psheader.txt    Wed Nov  2 09:10:58 1994
  52. @@ -244,7 +244,8 @@
  53.  % to the current position on the page.
  54.  
  55.  
  56.  /@beginspecial          % - @beginspecial -     -- enter special mode
  57. -  { SDict begin
  58. +  { 
  59.  
  60. +    SDict begin
  61.      /SpecialSave save N
  62.      gsave
  63.      normalscale
  64. @@ -285,13 +286,28 @@
  65.      grestore SpecialSave restore
  66.      end
  67.    } N
  68. +
  69. +% xdvik special treatment for saving definitions made in SDict (while using
  70. +% the bang special; try to guarantee that the dictionary stack is ok!
  71. +%   xdvik should not systematically bracket code within save/restore pairs,
  72. +% anyway: such bracketing breaks a lot of code (many packages do change
  73. +% TeXDict from with ps: specials for instance) and we should only guarantee
  74. +% that bracketing is done within @beginspecial and @endspecial.  -- YA
  75. +
  76. +/@xdvisavestate
  77. +  {
  78. +    /xdvi$sav save def
  79. +  } N
  80. +
  81.  /@defspecial
  82.    {
  83.      SDict begin
  84.    } N
  85. +
  86.  /@fedspecial
  87.    {
  88.      end
  89. +    @xdvisavestate
  90.    } B
  91.  
  92.  
  93.  %%% macros for tpic
  94. diff -u --recursive xdvik-18d-orig/xdvik/special.c xdvik-18d/xdvik/special.c
  95. --- xdvik-18d-orig/xdvik/special.c    Sat Oct  8 21:11:57 1994
  96. +++ xdvik-18d/xdvik/special.c    Tue Nov  1 12:17:44 1994
  97. @@ -711,7 +711,9 @@
  98.          /* Also raw PostScript, but no extra : to skip.  */
  99.  #if    PS
  100.          if (currwin.win == mane.win) {
  101. -          psp.drawbegin (currwin.base_x, currwin.base_y, cp);
  102. +          /* Don't forget to give the currentpoint - YA, 31 Oct 94 */
  103. +          psp.drawbegin (PXL_H - currwin.base_x, PXL_V - currwin.base_y,
  104. +          cp);
  105.            psp.drawend ("");
  106.          }
  107.  #endif
  108. @@ -850,6 +852,25 @@
  109.  
  110.  
  111.  
  112.  
  113.  static    void
  114. +bang_special(cp)
  115. +    char    *cp;
  116. +{
  117. +    bbox_valid = False;
  118. +
  119. +#if    PS
  120. +    if (currwin.win == mane.win) {
  121. +        psp.drawbegin(PXL_H - currwin.base_x, PXL_V - currwin.base_y,
  122. +            "@defspecial ");
  123. +        /* talk directly with the DPSHandler here */
  124. +        psp.drawraw(cp);
  125. +        psp.drawend(" @fedspecial");
  126. +    }
  127. +#endif
  128. +
  129. +    /* nothing else to do--there's no bbox here */
  130. +}
  131. +
  132. +static    void
  133.  quote_special(cp)
  134.      char    *cp;
  135.  {
  136. @@ -928,6 +949,7 @@
  137.      else if (strcmp(command, "PSf") == 0) epsf_special(cp);
  138.      else if (strcmp(command, "psf") == 0) epsf_special(cp);
  139.      else if (*orig_cp == '"') quote_special(orig_cp + 1);
  140. +    else if (*orig_cp == '!') bang_special(orig_cp + 1);
  141.      else if (!hush_spec_now)
  142.          Fprintf(stderr, "%s:  special \"%s\" not implemented\n", prog,
  143.          orig_cp);